import { request } from "@/utils/http";
import { Key } from "react";
import {
  getHosSetListItemType,
  addHosSetParamsType,
  getHosSetListParamsType,
  getHosSetListReturnType,
  updateHosSetParamsType,
} from "./model/hospitalSetTypes";

export const getHosSetListRequest = ({
  page,
  limit,
  hosname,
  hoscode,
}: getHosSetListParamsType) => {
  return request.get<any, getHosSetListReturnType>(
    `/admin/hosp/hospitalSet/${page}/${limit}`,
    {
      params: {
        hosname,
        hoscode,
      },
    }
  );
};
export const addHosSetFormRequest = (data: addHosSetParamsType) => {
  return request.post<any, null>("/admin/hosp/hospitalSet/save", data);
};

export const getHosSetFormIdRequest = (id: string | undefined) => {
  return request.get<any, getHosSetListItemType>(
    `/admin/hosp/hospitalSet/get/${id}`
  );
};

export const updateHosSetRequest = (data: updateHosSetParamsType) => {
    return request.put<any,null>('/admin/hosp/hospitalSet/update',data)
};

export const deleteHosSetRequest=(id:number)=>{
    return request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

export const batchRemoveHosSetRequest=(ids:Key[])=>{
    return request.delete<any,null>('admin/hosp/hospitalSet/batchRemove',{
        data:ids
    })
}
